package functionInterface;

import org.junit.Test;

import java.util.function.Consumer;

/**
 * @Author com.alibaba.lizhen
 * @Date 2021/3/22 11:16 下午
 * @Version 1.0
 * @Description
 */
public class ConsumerTest {


    @Test
    public void test() {
        changeStr("hello", (str) -> System.out.println(str));
        changeStr("hello", System.out::println);
    }

    /**
     * Consumer<T> 消费型接口
     *
     * @param str
     * @param con
     */
    public void changeStr(String str, Consumer<String> con){
        con.accept(str);
    }
}

